home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 April / CICA MS Windows - April 1993.iso / unzipped / programr / bcpp / mfc_bc / mfc_bc.txt
Text File  |  1992-07-10  |  19KB  |  788 lines

  1.  
  2.  
  3.  
  4.  
  5. Using Microsoft Foundation Classes
  6. with 
  7. Borland C++ 3.1
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. Prepared by:
  34. Language Business Unit
  35. Borland International
  36. 1800 Green Hills Road
  37. PO Box 660001
  38. Scotts Valley, CA  95067-0001
  39.  
  40.  
  41.  
  42. Table of Contents
  43.  
  44. Table of Contents    i
  45. Overview    1
  46. Changes to MFC    2
  47. Changes to SRC\VALIDADD.CPP    2
  48. Changes to SRC\DOSIO_.H    3
  49. Changes to SRC\OLEPTR_.H    3
  50. Changes to SRC\FILE.CPP    4
  51. Changes to SRC\WINDOW.CPP    4
  52. Changes to SRC\WINDLGS.CPP    5
  53. Changes to SRC\OBJECT.CPP    6
  54. Changes to the Build Process    7
  55. Preparing for the Build Process    7
  56. Changes to SRC\MAKEFILE    7
  57. Debug Information and TASM    11
  58. Memory Model Issues    12
  59. Building with 386^Max    12
  60. Building the Example Programs    13
  61. Changes to the Build Process    13
  62. Building An Example:  ABOUT2    13
  63. Changes to SAMPLES|ABOUT2\MAKEFILE    13
  64. Changes to SAMPLES\ABOUT2\ABOUT2.H    14
  65. Changes to Other Example Programs    14
  66. Changes to SAMPLES\CTRLTEST\WCLSTEST.CPP    14
  67. Changes to SAMPLES\CTRLTEST\PAREDIT2.CPP    15
  68. Changes to SAMPLES\CTRLTEST\FEATPEN.CPP    15
  69. Changes to SAMPLES\CTRLTEST\CUSTLIST.CPP    15
  70.  
  71.  
  72.  
  73.  
  74. Overview
  75.  
  76. This document describes how to build and use Microsoft Foundation Class (MFC) 
  77. programs with Borland C++ 3.1.  This document is divided into several sections.  The 
  78. first describes changes to make to the MFC source files; the second, changes and 
  79. suggestions for the build process; and the final section explores compiling an example 
  80. providing with Microsoft C/C++ 7.0.
  81.  
  82. The changes described in this document are necessary for several reasons.  Some relate to 
  83. non-standard syntax that Microsoft uses in their C++ compiler, while others relate to 
  84. differences in assembly language extensions and makefile conventions.
  85.  
  86. If you are using MFC for your Windows programs, you will find many advantages in 
  87. using Borland C++ 3.1 instead of Microsoft C/C++ 7.0:
  88.  
  89. *    Borland provides far faster development times, with its lightning fast compiles.
  90. *    Borland provides a Windows hosted IDE.
  91. *    Borland provides more sophisticated Windows tools, such as Resource Workshop, 
  92. WinSight, and WinSpector.
  93. *    Borland provides a far more robust, compliant implementation of C++.
  94. *    Borland provides templates and other advanced C++ features.
  95. *    Borland provides automatic, safe precompiled headers and a smart project manager.
  96.  
  97. If you are interested in a more detailed technical comparison of Borland C++ 3.1 and 
  98. Microsoft C/C++ 7.0, be sure to ask for our technical whitepaper:  "Borland C++ 3.1 & 
  99. Application Frameworks v. Microsoft C/C++ 7.0, An Expose".
  100.  
  101.  
  102.  
  103.  
  104. Changes to MFC
  105.  
  106. This section describes the various changes you will need to make to the MFC source 
  107. code.  Note that the line numbers mentioned are based on the version of MFC in the first 
  108. shipping packages of Microsoft C/C++ 7.0.  The actual line numbers are subject to 
  109. change should Microsoft provide interim versions of MFC.  Note further that any line 
  110. number references assume that you have made all previously mentioned changes to the 
  111. particular file.
  112.  
  113. Changes to SRC\VALIDADD.CPP    
  114.  
  115. 1.  Add the following lines at the top of the file:
  116.  
  117. #ifdef __TURBOC__
  118. #pragma inline
  119. #endif
  120.  
  121. 2.  Because "asm" in not a valid keyword within an existing inline asm statement in 
  122. Borland C++ 3.1, you need to change the _asm _emit's to db's in the following 
  123. manner:
  124.  
  125. #ifdef __TURBOC__
  126.             db  0x66
  127. #else
  128.             _asm _emit 0x66
  129. #endif
  130.  
  131. 3.  Because Borland C++ 3.1 doesn't accept inline asm labels, you need to make the    
  132. following labels into C++ labels:
  133.  
  134.     skip_write_test
  135.     skip_range_test
  136.     done
  137.  
  138. For example, instead of leaving the label skip_write_test in an inline asm block as 
  139. illustrated below,
  140.  
  141.             jnz     done
  142.     skip_write_test:
  143.         
  144. close the inline asm block, then open another after the label.
  145.  
  146.             jnz     done
  147.         }
  148.     skip_write_test:
  149.     _asm {
  150.  
  151.  
  152. The label done needs a semicolon after it as follows:
  153.  
  154.             }
  155.         skip_range_test:
  156.             _asm    {
  157.                 inc     word ptr bValid
  158.             }
  159.         done:
  160.             ;
  161.     }
  162.     else
  163.  
  164. 4.  The comparison:
  165.  
  166.             cmp     bReadWrite, 0
  167.  
  168. needs a type override.   You need to change it to 
  169.  
  170.             cmp     word ptr bReadWrite, 0
  171.  
  172. There are 2 occurrences of this statement in the file.  Also, the increment:
  173.  
  174.             inc bValid
  175.  
  176. needs a type override.   You need to change it to 
  177.  
  178.             inc word ptr bValid
  179.  
  180. There are also 2 occurrences of this statement in SRC\VALIDADD.CPP.
  181.  
  182. 5.  Borland C++ 3.1 doesn't allow assembler-style comments in inline assembler, so you 
  183. should change all such comments to C++ style comments.
  184.  
  185. Changes to SRC\DOSIO_.H    
  186.  
  187. 1.  Change line 33 from:
  188.  
  189. #define DOSCALL call DOS3Call
  190.  
  191.     to
  192.  
  193. #define DOSCALL call far ptr DOS3Call
  194.  
  195. Changes to SRC\OLEPTR_.H    
  196.  
  197. 1.  Because Borland C++ 3.1 does not allow Microsoft-style based pointers, you should 
  198. change line 17 from:
  199.  
  200.     ASSERT(_AFX_FP_SEG(lp) == _segname("_DATA"));
  201.  
  202.  to
  203.  
  204. #ifndef __TURBOC__
  205.     ASSERT(_AFX_FP_SEG(lp) == _segname("_DATA"));
  206. #endif
  207.  
  208. Changes to SRC\FILE.CPP    
  209.  
  210. 1.  Add the following lines at the top of the file:
  211.  
  212. #ifdef __TURBOC__
  213. #pragma inline
  214. #endif
  215.  
  216. 2.  Replace line 68 with the lines:
  217.  
  218.         }
  219.     __seek_err:
  220.     _asm    {
  221.  
  222. 3.  Replace line 87 with the lines:
  223.  
  224.         }
  225.     __rename_err:
  226.     _asm    {
  227.  
  228. 4.  Replace line 106 with the lines:
  229.  
  230.         }
  231.     __remove_err:
  232.     _asm    {
  233.  
  234. 5.  Replace line 129 with the lines:
  235.  
  236.         }
  237.     __lock_err1:
  238.     _asm    {
  239.  
  240. Changes to SRC\WINDOW.CPP    
  241.  
  242. The function FindMessageEntry has inline assembler statements which Borland 
  243. C++ 3.1 does not recognize.  You should replace this function with the following one,
  244. which is compatible with both MSC/C++ 7.0 and Borland C++ 3.1.
  245.  
  246. static CMessageEntry FAR* NEAR
  247. FindMessageEntry(CMessageEntry FAR* lpEntry, UINT nMsg, UINT nID)
  248. {
  249.     _asm    {
  250.                 LES     BX,lpEntry
  251.                 MOV     AX,nMsg
  252.                 MOV     DX,nID
  253.     }
  254.         __loop:
  255.     _asm    {
  256.  
  257.                 MOV     CX,WORD PTR ES:[BX+4]   // nSig (0 => 
  258. end)
  259.                 JCXZ    __failed
  260.                 CMP     AX,WORD PTR ES:[BX]     // nMessage
  261.                 JE      __found_1
  262.     }
  263.         __next:
  264. #ifdef __TURBOC__
  265.     static const   int CMESSAGEENTRYSIZE = sizeof(CMessageEntry);
  266.     _asm        {
  267.                 ADD     BX,CMESSAGEENTRYSIZE
  268.                 JMP     __loop
  269.     }
  270. #else
  271.     _asm        {
  272.                 ADD     BX,SIZE CMessageEntry
  273.                 JMP     __loop
  274.     }
  275. #endif
  276.         __found_1:
  277.     _asm    {
  278.                 CMP     DX,WORD PTR ES:[BX+2]   // nID
  279.                 JNE     __next
  280.         // found a match
  281.                 MOV     WORD PTR lpEntry,BX
  282.                 MOV     WORD PTR lpEntry+2,ES
  283.                 JMP     __end
  284.     }
  285.         __failed:
  286.     _asm    {
  287.                 XOR     AX,AX
  288.                 MOV     WORD PTR lpEntry,AX
  289.                 MOV     WORD PTR lpEntry+2,AX
  290.     }
  291.         __end:
  292.     return lpEntry;
  293. }
  294.  
  295. Changes to SRC\WINDLGS.CPP    
  296.  
  297. 1.  Line 705 contains a syntax error that MSC/C++ 7.0 does not detect.  You need to 
  298. change line 705 from:
  299.  
  300. 700: BOOL
  301. 701: CFindReplaceDialog::Create(BOOL bFindDialogOnly,
  302. 702:        LPCSTR lpszFindWhat,
  303. 703:        LPCSTR lpszReplaceWith /* = NULL */,
  304. 704:        DWORD dwFlags /* = FR_DOWN */,
  305. 705:        CWnd* pParentWnd ) : CDialog((UINT)0, pParentWnd)
  306. 706: {
  307.                               ^
  308.                                   the syntax error is here
  309.  
  310.  
  311.  to 
  312.  
  313. 700: BOOL
  314. 701: CFindReplaceDialog::Create(BOOL bFindDialogOnly,
  315. 702:        LPCSTR lpszFindWhat,
  316. 703:        LPCSTR lpszReplaceWith /* = NULL */,
  317. 704:        DWORD dwFlags /* = FR_DOWN */,
  318. 705:        CWnd* pParentWnd ) // : CDialog((UINT)0, pParentWnd)
  319. 706: {
  320.  
  321. Changes to SRC\OBJECT.CPP    
  322.  
  323. 1.  The function AfxNewHandler on line 179 is prototyped incorrectly to be used as a 
  324. new handler.  You should replace it with:
  325.  
  326. void    cdecl AfxNewHandler(void)
  327. {
  328.     //  AFX memory allocation will never return "NULL" it will always 
  329. throw
  330.     //      a memory exception instead
  331.     AfxThrowMemoryException();
  332. }
  333.  
  334.  
  335. Changes to the Build Process
  336.  
  337. This section describes changes you will need to make to your build process in order to 
  338. build MFC applications.  It covers changes to the makefile as well as particulars relating 
  339. to memory models and DPMI servers.
  340.  
  341. Preparing for the Build Process    
  342.  
  343. When building the MFC class library with Borland C++ 3.1, you must use Borland's 
  344. MAKE utility.  When you invoke MAKE, you need to specify all the switches you would 
  345. normally use with NMAKE and append these two options:
  346.  
  347. MAKE ...normal options... -D__TURBOC__ -N
  348.  
  349. Since MSC/C++ 7.0 requires the INCLUDE and LIB environment variables to be set, 
  350. while Borland C++ 3.1 does not, you will need to create a TURBOC.CFG file that 
  351. defines these paths.  Also, you will need to define some macros to control the building of 
  352. the MFC class library.
  353.  
  354. For example, if you installed Borland C++ 3.1 in C:\BORLANDC and MSC/C++ 7.0 in 
  355. C:\C700,  your TURBOC.CFG file would look like this:
  356.  
  357. -Ic:\borlandc\include    ; Standard headers
  358. -Ic:\c700\mfc\include    ; AFX headers
  359. -Lc:\borlandc\lib           ; Standard libraries
  360. -Lc:\c700\mfc\lib         ; MFC class libs
  361. -D__MSC             ; Tells std headers to allow MS bugs
  362. -DBASED_CODE        ; Don't use handle-based pointers
  363. -D_asm=asm          ; MS uses _asm, Borland uses asm
  364. -D_stat=stat
  365.  
  366. The default optimization options for compiling MFC with C/C++ 7.0 are /Oselg.  You 
  367. can use these options with Borland C++ 3.1, or you can compile with -O2 -po for fastest 
  368. code and -O1 -po for smallest code.
  369.  
  370. Changes to SRC\MAKEFILE    
  371.  
  372. Note:  all line number references that follow assume that you have made all previously 
  373. mentioned changes to the file.
  374.  
  375. 1.  Replace lines 47-48 with the lines:
  376.  
  377. !ifdef __TURBOC__
  378. CPP=bcc
  379. CC=bcc
  380. !else
  381.  
  382.  
  383. CPP=cl
  384. CC=cl
  385. !endif
  386.  
  387. 2.  Replace line 84 with the lines:
  388.  
  389. !ifdef __TURBOC__
  390. DEBUGOPTS=/Od /N
  391. !else
  392. DEBOPTS=/Odr /f
  393. !endif
  394.  
  395. 3.  Replace line 96 with the lines:
  396.  
  397. !ifdef __TURBOC__
  398. DEBOPTS=$(DEBOPTS) /v
  399. !else
  400. DEBOPTS=$(DEBOPTS) /Zi
  401. !endif
  402.  
  403. 4.  Replace line 105 with the lines:
  404.  
  405. !ifdef __TURBOC__
  406. CVEXTRA=/v
  407. !else
  408. CVEXTRA=/Zi
  409. !endif
  410.  
  411. 5.  Replace lines 112-128 with the lines:
  412.  
  413. !if "$(MODEL)"=="s" || "$(MODEL)"=="S" || "$(MODEL)"==""
  414. !ifdef __TURBOC__
  415. CL_MODEL=/ms /D_M_I86SM
  416. !else
  417. CL_MODEL=/AS
  418. !endif
  419. !else
  420. !if "$(MODEL)"=="m" || "$(MODEL)"=="M"
  421. !ifdef __TURBOC__
  422. CL_MODEL=/mm /D_M_I86MM
  423. !else
  424. CL_MODEL=/AM
  425. !endif
  426. !else
  427. !if "$(MODEL)"=="c" || "$(MODEL)"=="C"
  428. !ifdef __TURBOC__
  429. CL_MODEL=/mc /D_M_I86CM
  430. !else
  431. CL_MODEL=/AC
  432. !endif
  433. !else
  434. !if "$(MODEL)"=="l" || "$(MODEL)"=="L"
  435. !ifdef __TURBOC__
  436. CL_MODEL=/ml /D_M_I86LM
  437. !else
  438. CL_MODEL=/AL
  439. !endif
  440. !else
  441. !error MODEL must be one of S, M, C, L.
  442. !endif
  443. !endif
  444. !endif
  445. !endif
  446.  
  447. 6.  Replace lines 155-157 with the lines:
  448.  
  449. !ifdef __TURBOC__
  450. TARGOPTS=/WSE /OW /2
  451. MKWIN=1
  452. EXPFLAG=/WSE
  453. !else
  454. TARGOPTS=/GA /GEs /G2
  455. MKWIN=1
  456. EXPFLAG=/GEe
  457. !endif
  458.  
  459. 7.  Replace line 184 with the lines:
  460.  
  461. !ifdef __TURBOC__
  462. CL_OPT=/w /a- $(DEBOPTS) $(TARGOPTS) $(OPT)
  463. !else
  464. CL_OPT=/W3 /Zp $(DEBOPTS) $(TARGOPTS) $(OPT)
  465. !endif
  466.  
  467. 8.  Replace lines 196-199 with the lines:
  468.  
  469. !ifdef __TURBOC__
  470. TARGDEFS=/D_WINDOWS
  471. TARGOPTS=/WDE /2 /D_WINDLL
  472. !else
  473. CL_MODEL=$(CL_MODEL)w
  474. TARGDEFS=/D_WINDOWS
  475. TARGOPTS=/GD /G2
  476. # /GD will define _WINDLL
  477. !endif
  478.  
  479. 9.  Replace line 252 with the lines:
  480.  
  481. !ifdef __TURBOC__
  482. CPPFLAGS=$(CPPFLAGS) /H=$(PCH_FILE)
  483. !else
  484. CPPFLAGS=$(CPPFLAGS) /Yu /Fp$(PCH_FILE)
  485. !endif
  486.  
  487. 10.  Replace lines 264-271 with the lines:
  488.  
  489. !ifdef __TURBOC__
  490. .cpp{$D}.obj:
  491.     $(CPP) @<<
  492. $(CPPFLAGS) /c /o$@ $<
  493. <<
  494.  
  495. .c{$D}.obj:
  496.     $(CC) @<<
  497. $(CFLAGS) /c /o$@ $<
  498. <<
  499. !else
  500. .cpp{$D}.obj:
  501.     $(CPP) @<<
  502. $(CPPFLAGS) /c /Fo$@ $<
  503. <<
  504.  
  505. .c{$D}.obj:
  506.     $(CC) @<<
  507. $(CFLAGS) /c /Fo$@ $<
  508. <<
  509. !endif
  510.  
  511. 11.  Replace lines 310-312 with the lines:
  512.  
  513. !ifdef __TURBOC__
  514.     $(CPP) @<<
  515. /c /H=$(PCH_FILE) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT)
  516.         $(DEFS) $(CVEXTRA) /c /o$D\object.obj object.cpp
  517. <<
  518. !else
  519.     $(CPP) @<<
  520. /c /Yc /Fp$(PCH_FILE) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT)
  521.         $(DEFS) $(CVEXTRA) /c /Fo$D\object.obj object.cpp
  522. <<
  523. !endif
  524.  
  525. 12.  Replace lines 325-338 with the lines:
  526.  
  527. !ifdef __TURBOC__
  528. !if "$(CODEVIEW)"=="2"
  529. $D\memory.obj : memory.cpp
  530.     $(CPP) @<<
  531. $(CPPFLAGS) $(CVEXTRA) /c /o$D\memory.obj memory.cpp
  532. <<
  533.  
  534. !ifdef MKWIN
  535. $D\winmain.obj : winmain.cpp
  536.     $(CPP) @<<
  537. $(CPPFLAGS) $(CVEXTRA) /c /o$D\winmain.obj winmain.cpp
  538. <<
  539.  
  540. $D\window.obj : window.cpp
  541.     $(CPP) @<<
  542. $(CPPFLAGS) $(CVEXTRA) /c /o$D\window.obj window.cpp
  543. <<
  544.  
  545. $D\winapp.obj : winapp.cpp
  546.     $(CPP) @<<
  547. $(CPPFLAGS) $(CVEXTRA) /c /o$D\winapp.obj winapp.cpp
  548. <<
  549. !endif
  550. !endif
  551. !else
  552. !if "$(CODEVIEW)"=="2"
  553. $D\memory.obj : memory.cpp
  554.     $(CPP) @<<
  555. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\memory.obj memory.cpp
  556. <<
  557.  
  558. !ifdef MKWIN
  559. $D\winmain.obj : winmain.cpp
  560.     $(CPP) @<<
  561. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winmain.obj winmain.cpp
  562. <<
  563.  
  564. $D\window.obj : window.cpp
  565.     $(CPP) @<<
  566. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\window.obj window.cpp
  567. <<
  568.  
  569. $D\winapp.obj : winapp.cpp
  570.     $(CPP) @<<
  571. $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winapp.obj winapp.cpp
  572. <<
  573. !endif
  574. !endif
  575. !endif
  576.  
  577. 13.  Replace lines 378-380 with the following lines:
  578.  
  579. !ifdef __TURBOC__
  580.     $(CPP) @<<
  581. $(CPPFLAGS) $(EXPFLAG) /c /o$D\version.obj version.cpp
  582. <<
  583. !else
  584.     $(CPP) @<<
  585. $(CPPFLAGS) $(EXPFLAG) /c /Fo$D\version.obj version.cpp
  586. <<
  587. !endif
  588.  
  589. 14.  Replace lines 394-400 with the following lines:
  590.  
  591. !ifdef __TURBOC__
  592.     tlib /P128 @<<
  593. ..\lib\$(GOAL) &
  594. -+$(OBJS:.obj =.obj -+)
  595. <<
  596. !else
  597.     lib /PAGESIZE:128 @<<
  598. ..\lib\$(GOAL)
  599. y
  600. $(OBJS)
  601. nul
  602. ;
  603. <<
  604. !endif
  605.  
  606. 15.  Replace all occurences of $D with $(D)
  607.  
  608. Debug Information and TASM    
  609.  
  610. The debug information in some files that contain inline assembler statements may cause 
  611. TASM to run out of memory.  You can:
  612.  
  613. 1.    Try to give TASM more memory.
  614. 2.    Compile the file outside of the MAKE procedure.
  615. 3.    Try using MAKER -S to free more real-mode memory for TASM during the MAKE 
  616. process.
  617. 4.    Change SRC\MAKEFILE to spawn TASMX for the offending files.  For example,    
  618. to compile and assemble SRC\FILE.CPP, add the following line to the end of 
  619. SRC\MAKEFILE:
  620.  
  621.     $D\file.obj : file.cpp
  622.         $(CPP) $(CFLAGS) -S -n$(D) file.cpp
  623.             @tasmx /ml /t $(D)\file.asm,$(D)\file.obj
  624.  
  625. Memory Model Issues    
  626.  
  627. In medium model, the MFC class library source code relies on a non-standard extension 
  628. to member function modifiers.  You cannot compile the MFC class library in medium 
  629. model with any compiler that does not support this non-standard extension.
  630.  
  631. In small or compact model, some of the example programs will not link with Borland 
  632. C++ 3.1.  This is because more of the runtime library is pulled in by the link step.  To 
  633. run these examples, use a larger memory model.
  634.  
  635. Building with 386^Max    
  636.  
  637. If you are running the version of 386^Max that comes with MSC/C++ 7.0, version 6.01d, 
  638. you may get errors or hangs from 386max's DPMI server while building the MFC class 
  639. library or example files.  If this happens, insert the following line in the 386MAX.PRO 
  640. file in the directory where 386MAX is installled:
  641.  
  642. NODPMI
  643.  
  644. This will allow Borland C++ 3.1 to use its own DPMI server and will prevent these 
  645. problems.
  646.  
  647.  
  648.  
  649. Building the Example Programs
  650.  
  651. This section discusses building the MFC sample programs using Borland C++ 3.1.  You 
  652. will need to make changes to your build process, and in some cases fix syntax errors in 
  653. the sample programs.
  654.  
  655. Changes to the Build Process    
  656.  
  657. To build the sample applications, you will need to copy the TURBOC.CFG from the 
  658. MFC\SRC directory.  In addition, because the resource compiler does not explicitly path 
  659. WINDOWS.H and other header files, you must change the implicit rule in your 
  660. BUILTINS.MAK file so that MAKE will include the directory where the headers reside.  
  661.  
  662. For example, if you installed Borland C++ 3.1 in C:\BORLANDC and MSC/C++ 7.0 in 
  663. C:\C700, you would change the .rc.res rule to:
  664.  
  665. .rc.res:
  666.       $(RC) $(RFLAGS) /I\borlandc\include;\c700\mfc\include /r $&
  667.  
  668. Building An Example:  ABOUT2    
  669.  
  670. The makefiles for the sample programs follow the same pattern.  To build a sample with 
  671. Borland C++ 3.1, you will need to change each makefile.  The steps for doing this 
  672. follow, using ABOUT2 as an example.  In addition to changing the makefile, you will 
  673. have to change some of the source files.  
  674.  
  675. Note that the examples are all small model examples.  If you have built the large model 
  676. libary, you must change the makefile to use that library.  If you have problems linking 
  677. the examples in small model with Borland C++ 3.1, rebuild the library and the example 
  678. in large model.
  679.  
  680. Begin by copying MFC\SRC\TURBOC.CFG into the SAMPLES\ABOUT2 directory.  
  681. Remember, you must repeat this step for each example program that you build.
  682.  
  683. Changes to SAMPLES|ABOUT2\MAKEFILE
  684.  
  685. 1.  Replace lines 25-36 with the lines:
  686.  
  687. !ifdef __TURBOC__
  688. CPPFLAGS=  /DWINVER=0x0310 /ms /w /a- /WE /OW /2
  689. LINKFLAGS=/Twe /L\borlandc\lib;\c700\mfc\lib
  690.  
  691. !if "$(DEBUG)"=="1"
  692. CPPFLAGS=/D_DEBUG $(CPPFLAGS) /Od /v /N
  693. LINKFLAGS=$(LINKFLAGS) /v
  694. LIBS=safxcwd cws
  695. !else
  696. CPPFLAGS=$(CPPFLAGS) /Oselg
  697. LINKFLAGS=$(LINKFLAGS)
  698. LIBS=safxcw cws
  699. !endif
  700. !else
  701. CPPFLAGS=  /DWINVER=0x0300 /AS /W3 /Zp /GA /GEs /G2
  702. LINKFLAGS=/NOD /ONERROR:NOEXE
  703.  
  704. !if "$(DEBUG)"=="1"
  705. CPPFLAGS=/D_DEBUG $(CPPFLAGS) /Od /f /Zi
  706. LINKFLAGS=$(LINKFLAGS) /COD
  707. LIBS=safxcwd libw slibcew
  708. !else
  709. CPPFLAGS=$(CPPFLAGS) /Oselg /Gs
  710. LINKFLAGS=$(LINKFLAGS)
  711. LIBS=safxcw libw slibcew
  712. !endif
  713. !endif
  714.  
  715. 2.  Replace line 55 with the lines:
  716.  
  717. !ifdef __TURBOC__
  718.         tlink $(LINKFLAGS) c0ws about2, about2, NUL, $(LIBS), 
  719. about2.def;
  720. !else
  721.         link $(LINKFLAGS) about2, about2, NUL, $(LIBS), about2.def;
  722. !endif
  723.  
  724. Changes to SAMPLES\ABOUT2\ABOUT2.H
  725.  
  726. 1.  Line 92 has a syntax error.  DECLARE_MESSAGE_MAP() cannot be followed by a 
  727. semicolon.  You should change it to:
  728.  
  729. 90:        // Message map defined in the .cpp file.
  730. 91:        //
  731. 92:        DECLARE_MESSAGE_MAP()
  732. 93:    private:
  733. 94:        short m_nCurrentColor;
  734. 95:        short m_nCurrentFigure;
  735. 96:    };
  736.  
  737. Changes to Other Example Programs    
  738.  
  739. The following describes changes you will need to make to some of the other sample 
  740. programs provided with C/C++ 7.0.
  741.  
  742. Changes to SAMPLES\CTRLTEST\WCLSTEST.CPP
  743.  
  744. 1.  Line 26 has a syntax error.  DECLARE_MESSAGE_MAP() cannot be followed by a   
  745. semicolon.  You should change it to:
  746.  
  747. 25:     void OnIllegalChar();
  748. 26:        DECLARE_MESSAGE_MAP()
  749. 27:    };
  750.  
  751. Changes to SAMPLES\CTRLTEST\PAREDIT2.CPP
  752.  
  753. 1.  Line 41 has a syntax error.  DECLARE_MESSAGE_MAP() cannot be followed by a    
  754. semicolon.  You should change it to:
  755.  
  756. 40:     static LONG FAR PASCAL __export WndProcHook(HWND, UINT, UINT, 
  757. LONG);
  758. 41:        DECLARE_MESSAGE_MAP()
  759.  
  760. Changes to SAMPLES\CTRLTEST\FEATPEN.CPP
  761.  
  762. 1.  Lines 38 and 97 have syntax errors.  DECLARE_MESSAGE_MAP() cannot be 
  763. followed by a semicolon.  You should change these lines to:
  764.  
  765. 37:     void OnConfigure();
  766. 38:     DECLARE_MESSAGE_MAP()
  767. 39: };
  768.  
  769. 96:    void OnChooseInkColor();
  770. 97:    DECLARE_MESSAGE_MAP()
  771. 98:};
  772.  
  773. Changes to SAMPLES\CTRLTEST\CUSTLIST.CPP
  774.  
  775. 1.  Line 121 has a syntax error.  DECLARE_MESSAGE_MAP() cannot be followed by 
  776. a semicolon.  You should change it to:
  777.  
  778. 120:    void OnOK();
  779. 121:    DECLARE_MESSAGE_MAP()
  780. 122:};
  781.  
  782.  
  783.  
  784.  
  785. 15
  786.  
  787.  
  788.